//
// Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// A copy of the License is located at
//
// http://aws.amazon.com/apache2.0
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.
//

// ############################################################################
// Auto-generated file. Do not edit this file manually
// ############################################################################

import Foundation
import AWSCore

/// Credentials provider for the various tests. Keys and tokens are hardcoded in the `generate_swift_test_cases` script
struct SigV4TestCredentials {
    static let regionName = "us-east-1"
    static let serviceName = "service"

    // 20150830T123600Z
    static let testDate = Date(timeIntervalSince1970: 1440938160)
    static let expiry: Int32 = 86400

    static let basicTestCredentials = AWSStaticCredentialsProvider(accessKey: "AKIDEXAMPLE",
                                                                   secretKey: "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY")

    static let sessionTestCredentials = AWSBasicSessionCredentialsProvider(accessKey: "AKIDEXAMPLE",
                                                                           secretKey: "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY",
                                                                           sessionToken: "AQoDYXdzEPT//////////wEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQWLWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI/qkPpKPi/kMcGdQrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d+xo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz+scqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR/oLxBA==")

}

struct SigV4PresignedURLTestCases {
    static let allCases = [

<% test_cases.each do |test_case| %>
// MARK: - Test Case "<%= test_case.name %>"

SigV4TestCase(

testCaseName: "<%= test_case.name %>",

// Given
<% if test_case.credentials_provider.is_a? BasicAssumeRoleCredentialsProvider %>
credentialsProvider: SigV4TestCredentials.sessionTestCredentials,
<% else %>
credentialsProvider: SigV4TestCredentials.basicTestCredentials,
<% end %>
shouldSignBody: <%= test_case.sign_body %>,
shouldSignSecurityToken: <%= test_case.sign_security_token %>,

// When
originalRequest:
"""
<%= test_case.request %>
""",

// Then
expectedPresignedURL: "<%= test_case.result.url %>",

canonicalRequest:
"""
<%= test_case.result.canonical_request %>
""",

stringToSign:
"""
<%= test_case.result.string_to_sign %>
""",

signature:
"""
<%= test_case.result.signature %>
"""
),

<% end %>
    ]
}
